package com.zygh.policeasset.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zygh.policeasset.mapper.HelpContentMapper;
import com.zygh.policeasset.mapper.UnitMapper;
import com.zygh.policeasset.pojo.HelpContent;
import com.zygh.policeasset.pojo.Unit;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HelpContentService {
    @Autowired
    HelpContentMapper helpContentMapper;

    public List<HelpContent> findAllByTitle(String title) {
        return helpContentMapper.findAllByTitle(title);
    }

    public PageInfo findAll(int pageNum, int pageSize, String title) {
        PageHelper.startPage(pageNum, pageSize);
        return new PageInfo(this.helpContentMapper.findAllByTitle(title));
    }

    public Integer add(HelpContent helpContent) {
        return helpContentMapper.add(helpContent);
    }

    public Integer update(HelpContent helpContent) {
        return helpContentMapper.update(helpContent);
    }

    public Integer delete(Integer id) {
        return helpContentMapper.delete(id);
    }

    public HelpContent findById(Integer id) {
        return helpContentMapper.findById(id);
    }
}